Skip to content

add(feature): Make request.signal.onabort work in route handlers #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sommeeeer
Copy link
Collaborator

@sommeeeer sommeeeer commented Aug 7, 2025

Work in progress, therefor its still in Draft mode:

  • Test on latest Next 14
  • Finish E2E
  • Refactor the cloudflareContextALS part to align with the maintainers preferences. Currently its just untyped and in the ALS store.
  • Page router API routes is not supported, and it uses IncomingMessage. Is it possible to patch this aswell? Investigate this. Its not supported in next start BTW. So we would have to override the type aswell.

Should close #691

On May 22, 2025 Cloudflare added this to workers:
https://developers.cloudflare.com/changelog/2025-05-22-handle-request-cancellation/

By patching this method from Next I figured out we might be able to use it for passing in the original signal from the workers Request. This turned out to be true.

Thanks to our beloved @conico974 for teaching me some ast-grep :) Rule number one: smallest to biggest.

Any suggestions on how to E2E this the proper way are more than welcome!

Copy link

changeset-bot bot commented Aug 7, 2025

🦋 Changeset detected

Latest commit: 8b953f3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Aug 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@847

commit: 8b953f3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] request.signal.onabort is never triggered
1 participant